package org.tinygroup.earthworm3;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

public class WormBaseContext3 {
	static final int DEFAULT_LOCAL_INDEX = 1;
	static final int DEFAULT_RPC_INDEX = 1;
	// 全局唯一ID
	String traceId;
	// 层次ID。0.x.x
	String spanId;
	String traceName;
	String methodName;

	AtomicInteger childIdx;
	// 对应start/endTrace的的时间，beginTime是开始时间，traceTime是执行时间
	
	String serviceId;
	// 存放自定义信息
	Map<String, String> customInofos = new HashMap<String, String>();
	Map<String, String> localAttributes= new HashMap<String, String>();

	WormBaseContext3(String _traceId, String _spanId) {
		this.traceName = "";
		this.serviceId = "";
		this.methodName = "";
		this.traceId = _traceId;
		this.spanId = _spanId;
	}
	
	public String getNextChild(){
		return spanId+"."+childIdx.getAndIncrement();
	}
}
